// 只保留元件工厂函数和circuitComponents对象，图片路径建议用assets.js统一管理
// 这里只做结构迁移，图片路径后续可进一步优化

import * as assets from './assets.js';
const BASE_IMAGE_PATH = "/static/circuit_img/";

// 以下为所有元件工厂函数，全部用 export function 导出
export function power1(x = 0, y = 0) {
  return {
    x, y,
    width: 125,
    height: 56,
    type: 'power1',
    name: '家庭电源',
    images: [BASE_IMAGE_PATH + 'power.png'],
    nodes: [
      {
        dx: 13,
        dy: 50,
        status: "live",
      },
      {
        dx: 62,
        dy: 50,
        status: "neutral",
      },
      {
        dx: 112,
        dy: 50,
        status: "earth",
      },
    ],
  };
}

export function power2(x = 0, y = 0) {
  return {
    x,
    y,
    width: 148,
    height: 27,
    type: "power2",
    name: "工业电源",
    images: [BASE_IMAGE_PATH + "industry-power.png"],
    nodes: [
      {
        dx: 6,
        dy: 21,
        status: "l1",
      },
      {
        dx: 43,
        dy: 21,
        status: "l2",
      },
      {
        dx: 80,
        dy: 21,
        status: "l3",
      },
      {
        dx: 142,
        dy: 21,
        status: "earth",
      },
    ],
  };
}

export function power3(x = 0, y = 0) {
  // Implementation of power3 function
  return {
    x,
    y,
    width: 222,
    height: 27,
    type: "power3",
    name: "工业电源+家庭电源",
    images: [BASE_IMAGE_PATH + "industry-power2.png"],
    nodes: [
      {
        dx: 6,
        dy: 21,
        status: "l1",
      },
      {
        dx: 43,
        dy: 21,
        status: "l2",
      },
      {
        dx: 80,
        dy: 21,
        status: "l3",
      },
      {
        dx: 142,
        dy: 21,
        status: "live",
      },
      {
        dx: 179,
        dy: 21,
        status: "neutral",
      },
      {
        dx: 216,
        dy: 21,
        status: "earth",
      },
    ],
  };
}

export function power4(x = 0, y = 0) {
  return {
    x, y,
    width: 222,
    height: 27,
    type: 'power4',
    name: "实操考试电源",
    images: [BASE_IMAGE_PATH + "exam-power.png"],
    nodes: [
      {
        dx: 6,
        dy: 21,
        status: "l1",
      },
      {
        dx: 43,
        dy: 21,
        status: "l2",
      },
      {
        dx: 80,
        dy: 21,
        status: "l3",
      },
      {
        dx: 142,
        dy: 21,
        status: "live",
      },
      {
        dx: 179,
        dy: 21,
        status: "neutral",
      },
      {
        dx: 216,
        dy: 21,
        status: "earth",
      },
    ],
  };
}

export function sw1(x = 0, y = 0) {
  return {
    x,
    y,
    width: 62,
    height: 102,
    type: "sw1",
    name: "单开单控",
    images: [BASE_IMAGE_PATH + "sw-1.png", BASE_IMAGE_PATH + "sw-1-1.png"],
    nodes: [
      {
        dx: 31,
        dy: 6,
      },
      {
        dx: 31,
        dy: 96,
      },
    ],
  };
}

export function sw2(x = 0, y = 0) {
  // Implementation of sw2 function
  return {
    x,
    y,
    width: 62,
    height: 102,
    type: "sw2",
    name: "单开双控",
    images: [BASE_IMAGE_PATH + "sw-2.png", BASE_IMAGE_PATH + "sw-2-1.png"],
    nodes: [
      {
        dx: 31,
        dy: 6,
      },
      {
        dx: 18,
        dy: 96,
      },
      {
        dx: 45,
        dy: 96,
      },
    ],
  };
}

export function sw3(x = 0, y = 0) {
  return {
    x,
    y,
    width: 93,
    height: 102,
    type: "sw3",
    name: "双开双控",
    images: [
      BASE_IMAGE_PATH + "sw-3.png",
      BASE_IMAGE_PATH + "sw-3-1.png",
      BASE_IMAGE_PATH + "sw-3-2.png",
      BASE_IMAGE_PATH + "sw-3-3.png",
    ],
    nodes: [
      {
        dx: 27,
        dy: 6,
      },
      {
        dx: 66,
        dy: 6,
      },
      {
        dx: 6,
        dy: 96,
      },
      {
        dx: 33,
        dy: 96,
      },
      {
        dx: 60,
        dy: 96,
      },
      {
        dx: 87,
        dy: 96,
      },
    ],
  };
}

export function sw4(x = 0, y = 0) {
  // Implementation of sw4 function
  return {
    x,
    y,
    width: 88,
    height: 112,
    type: "sw4",
    name: "一开五孔双控",
    images: [BASE_IMAGE_PATH + "sw-4.png", BASE_IMAGE_PATH + "sw-4-1.png"],
    nodes: [
      {
        dx: 82,
        dy: 6,
      },
      {
        dx: 50,
        dy: 106,
      },
      {
        dx: 70,
        dy: 106,
      },  
      {
        dx: 6,
        dy: 6,
      },
      {
        dx: 32,
        dy: 6,
      },
      {
        dx: 57,
        dy: 6,
      },
    ],
  };
}

export function sw5(x = 0, y = 0) {
  // Implementation of sw5 function
  return {
    x,
    y,
    width: 93,
    height: 107,
    type: "sw5",
    name: "单开多控",
    images: [
      BASE_IMAGE_PATH + "sw-5.png",
      BASE_IMAGE_PATH + "sw-5-1.png",
    ],
    nodes: [
      {
        dx: 27,
        dy: 6,
      },
      {
        dx: 66,
        dy: 6,
      },
      {
        dx: 6,
        dy: 101,
      },
      {
        dx: 33,
        dy: 101,
      },
      {
        dx: 60,
        dy: 101,
      },
      {
        dx: 87,
        dy: 101,
      },
    ],
  };
}

export function sw6(x = 0, y = 0) {
  // Implementation of sw6 function
  return {
    x,
    y,
    width: 88,
    height: 112,
    type: "sw6",
    name: "一开五孔单控",
    images: [
      BASE_IMAGE_PATH + "sw-6.png",
      BASE_IMAGE_PATH + "sw-6-1.png",
    ],
    nodes: [
      {
        dx: 82,
        dy: 6,
      },
      {
        dx: 59,
        dy: 106,
      },
      {
        dx: 6,
        dy: 6,
      },
      {
        dx: 32,
        dy: 6,
      },
      {
        dx: 57,
        dy: 6,
      },
    ],
  };
}

export function asw1(x = 0, y = 0, opt = {}) {
  // Implementation of asw1 function
  return {
    x,
    y,
    width: 23,
    height: 91,
    type: "asw1",
    name: "空气开关1p",
    text: n,
    images: [BASE_IMAGE_PATH + "a-sw1.png", BASE_IMAGE_PATH + "a-sw1-1.png"],
    nodes: [
      {
        dx: 12,
        dy: 8,
      },
      {
        dx: 12,
        dy: 83,
      },
    ],
  };
}

export function asw2(x = 0, y = 0) {
  // Implementation of asw2 function
  return {
    x,
    y,
    width: 45,
    height: 91,
    type: "asw2",
    name: "空气开关2p",
    images: [BASE_IMAGE_PATH + "a-sw2.png", BASE_IMAGE_PATH + "a-sw2-1.png"],
    nodes: [
      {
        dx: 12,
        dy: 8,
      },
      {
        dx: 34,
        dy: 8,
      },
      {
        dx: 12,
        dy: 83,
      },
      {
        dx: 34,
        dy: 83,
      },
    ],
  };
}

export function asw3(x = 0, y = 0) {
  // Implementation of asw3 function
  return {
    x,
    y,
    width: 65,
    height: 91,
    type: "asw3",
    name: "空气开关3p",
    images: [BASE_IMAGE_PATH + "a-sw3.png", BASE_IMAGE_PATH + "a-sw3-1.png"],
    nodes: [
      {
        dx: 12,
        dy: 8,
      },
      {
        dx: 33,
        dy: 8,
      },
      {
        dx: 54,
        dy: 8,
      },
      {
        dx: 12,
        dy: 84,
      },
      {
        dx: 33,
        dy: 84,
      },
      {
        dx: 54,
        dy: 84,
      },
    ],
  };
}

export function bulb(x = 0, y = 0) {
  // Implementation of bulb function
  return {
    x,
    y,
    width: 81,
    height: 103,
    type: "bulb",
    name: "灯泡",
    images: [BASE_IMAGE_PATH + "bulb.png", BASE_IMAGE_PATH + "bulb-l.png"],
    nodes: [
      {
        dx: 6,
        dy: 97,
      },
      {
        dx: 75,
        dy: 79,
      },
    ],
  };
}

export function meter(x = 0, y = 0) {
  return {
    x,
    y,
    width: 77,
    height: 94,
    type: "meter",
    name: "电表",
    images: [BASE_IMAGE_PATH + "meter.png"],
    nodes: [
      {
        dx: 11,
        dy: 84,
      },
      {
        dx: 29,
        dy: 84,
      },
      {
        dx: 48,
        dy: 84,
      },
      {
        dx: 66,
        dy: 84,
      },
    ],
  };
  // Implementation of meter function
}

export function fuse3(x = 0, y = 0) {
  // Implementation of fuse3 function
  return {
    x,
    y,
    width: 67,
    height: 99,
    type: "fuse3",
    name: "熔断器3p",
    images: [BASE_IMAGE_PATH + "fuse-3p.png"],
    nodes: [
      {
        dx: 12,
        dy: 11,
      },
      {
        dx: 34,
        dy: 11,
      },
      {
        dx: 56,
        dy: 11,
      },
      {
        dx: 12,
        dy: 90,
      },
      {
        dx: 34,
        dy: 90,
      },
      {
        dx: 56,
        dy: 90,
      },
    ],
  };
}

export function motor(x = 0, y = 0) {
  return {
    x,
    y,
    width: 145,
    height: 80,
    type: "motor",
    name: "电机",
    images: [
      BASE_IMAGE_PATH + "motor-1.png",
      BASE_IMAGE_PATH + "motor-2.png",
      BASE_IMAGE_PATH + "motor-3.png",
      BASE_IMAGE_PATH + "motor-4.png",
      BASE_IMAGE_PATH + "motor-5.png",
    ],
    nodes: [
      {
        dx: 73,
        dy: 38,
      },
      {
        dx: 96,
        dy: 38,
      },
      {
        dx: 117,
        dy: 38,
      },
      {
        dx: 139,
        dy: 38,
      },
    ],
  };
}

export function asyncMotor(x = 0, y = 0) {
  // Implementation of asyncMotor function
  return {
    x,
    y,
    width: 145,
    height: 80,
    type: "asyncMotor",
    name: "异步电机",
    images: [
      BASE_IMAGE_PATH + "async-motor-1.png",
      BASE_IMAGE_PATH + "async-motor-2.png",
      BASE_IMAGE_PATH + "async-motor-3.png",
      BASE_IMAGE_PATH + "async-motor-4.png",
      BASE_IMAGE_PATH + "async-motor-5.png",
    ],
    nodes: [
      {
        dx: 73,
        dy: 23,
      },
      {
        dx: 95,
        dy: 23,
      },
      {
        dx: 117,
        dy: 23,
      },
      {
        dx: 73,
        dy: 53,
      },
      {
        dx: 95,
        dy: 53,
      },
      {
        dx: 117,
        dy: 53,
      },
      {
        dx: 139,
        dy: 53,
      },
    ],
  };
}

export function compoundButtonFactory(x = 0, y = 0, opt = {}) {
  var opt = opt || {},
    type = opt.type || "compoundButton",
    color = opt.color || "green",
    text = opt.text;
  return {
    x,
    y,
    width: 81,
    height: 59,
    type: "compoundButton",
    name: "复合按钮",
    images: {
      green: [
        BASE_IMAGE_PATH + "compound-button-green.png",
        BASE_IMAGE_PATH + "compound-button-green-1.png",
      ],
      red: [
        BASE_IMAGE_PATH + "compound-button-red.png",
        BASE_IMAGE_PATH + "compound-button-red-1.png",
      ],
    }[color],
    text: opt.text,
    nodes: [
      {
        dx: 6,
        dy: 33,
      },
      {
        dx: 75,
        dy: 33,
      },
      {
        dx: 6,
        dy: 53,
      },
      {
        dx: 75,
        dy: 53,
      },
    ],
  };
}

export function compoundButton(x = 0, y = 0, opt = {}) {
  return compoundButtonFactory(x, y, {
    type: "compoundButton",
    text: opt.text,
  });
}

export function compoundButtonRed(x = 0, y = 0, opt = {}) {
  return compoundButtonFactory(x, y, {
    type: "compoundButtonRed",
    color: "red",
    text: opt.text,
  });
}


export function ACContactor(x = 0, y = 0) {
  // Implementation of ACContactor function
  return {
    x,
    y,
    width: 81,
    height: 140,
    type: "ACContactor",
    name: "交流接触器",
    images: [BASE_IMAGE_PATH + "AC-contactor.png"],
    nodes: [
      {
        dx: 12,
        dy: 16,
      },
      {
        dx: 69,
        dy: 16,
      },
      {
        dx: 12,
        dy: 33,
      },
      {
        dx: 31,
        dy: 33,
      },
      {
        dx: 50,
        dy: 33,
      },
      {
        dx: 68,
        dy: 33,
      },
      {
        dx: 12,
        dy: 68,
      },
      {
        dx: 68,
        dy: 68,
      },
      {
        dx: 12,
        dy: 108,
      },
      {
        dx: 31,
        dy: 108,
      },
      {
        dx: 50,
        dy: 108,
      },
      {
        dx: 68,
        dy: 108,
      },
      {
        dx: 68,
        dy: 124,
      },
    ],
  };
}

export function ACContactor2(x = 0, y = 0) {
  // Implementation of ACContactor2 function
  return {
    x, 
    y,
    width: 81,
    height: 140,
    type: "ACContactor2",
    name: "交流接触器",
    images: [BASE_IMAGE_PATH + "AC-contactor-2.png"],
    nodes: [
      {
        dx: 12,
        dy: 16,
      },
      {
        dx: 12,
        dy: 33,
      },
      {
        dx: 31,
        dy: 33,
      },
      {
        dx: 50,
        dy: 33,
      },
      {
        dx: 68,
        dy: 33,
      },
      {
        dx: 12,
        dy: 68,
      },
      {
        dx: 68,
        dy: 68,
      },
      {
        dx: 12,
        dy: 108,
      },
      {
        dx: 31,
        dy: 108,
      },
      {
        dx: 50,
        dy: 108,
      },
      {
        dx: 68,
        dy: 108,
      },
      {
        dx: 68,
        dy: 124,
      },
    ],
  };
}

export function ACContactorOpen(x = 0, y = 0) {
  // Implementation of ACContactorOpen function
  return {
    x,
    y,
    width: 81,
    height: 140,
    type: "ACContactorOpen",
    name: "常开交流接触器",
    images: [BASE_IMAGE_PATH + "AC-contactor-open.png"],
    nodes: [
      {
        dx: 12,
        dy: 16,
      },
      {
        dx: 69,
        dy: 16,
      },
      {
        dx: 12,
        dy: 33,
      },
      {
        dx: 31,
        dy: 33,
      },
      {
        dx: 50,
        dy: 33,
      },
      {
        dx: 68,
        dy: 33,
      },
      {
        dx: 12,
        dy: 108,
      },
      {
        dx: 31,
        dy: 108,
      },
      {
        dx: 50,
        dy: 108,
      },
      {
        dx: 68,
        dy: 108,
      },
      {
        dx: 68,
        dy: 124,
      },
    ],
  };
}

export function ACContactorOpen2(x = 0, y = 0) {
  // Implementation of ACContactorOpen2 function
  return {
    x,
    y,
    width: 81,
    height: 140,
    type: "ACContactorOpen2",
    name: "常开交流接触器",
    images: [BASE_IMAGE_PATH + "AC-contactor-open-2.png"],
    nodes: [
      {
        dx: 12,
        dy: 16,
      },
      {
        dx: 12, 
        dy: 33,
      },
      {
        dx: 31,
        dy: 33,
      },
      {
        dx: 50,
        dy: 33,
      },
      {
        dx: 68,
        dy: 33,
      },
      {
        dx: 12,
        dy: 108,
      },
      {
        dx: 31,
        dy: 108,
      },
      {
        dx: 50,
        dy: 108,
      },
      {
        dx: 68,
        dy: 108,
      },
      {
        dx: 68,
        dy: 124,
      },
    ],
  };
}

export function ACContactorClose(x = 0, y = 0) {
  // Implementation of ACContactorClose function
  return {
    x,
    y,
    width: 81,
    height: 140,  
    type: "ACContactorClose",
    name: "常闭交流接触器",
    images: [BASE_IMAGE_PATH + "AC-contactor-close.png"],
    nodes: [
      {
        dx: 12,
        dy: 16,
      },
      {
        dx: 68,
        dy: 16,
      },
      {
        dx: 12,
        dy: 33,
      },
      {
        dx: 31,
        dy: 33,
      },
      {
        dx: 50,
        dy: 33,
      },
      {
        dx: 68,
        dy: 33,
      },
      {
        dx: 12,
        dy: 108,
      },
      {
        dx: 31,
        dy: 108,
      },
      {
        dx: 50,
        dy: 108,
      },
      {
        dx: 68,
        dy: 108,
      },
      {
        dx: 68,
        dy: 124,
      },
    ],
  };
}

export function ACContactorClose2(x = 0, y = 0) {
  // Implementation of ACContactorClose2 function
  return {
    x,
    y,
    width: 81,
    height: 140,
    type: "ACContactorClose2",
    name: "常闭交流接触器",
    images: [BASE_IMAGE_PATH + "AC-contactor-close-2.png"],
    nodes: [
      {
        dx: 12,
        dy: 16,
      },
      {
        dx: 12,
        dy: 33,
      },
      {
        dx: 31,
        dy: 33,
      },
      {
        dx: 50,
        dy: 33,
      },
      {
        dx: 68,
        dy: 33,
      },
      {
        dx: 12,
        dy: 108,
      },
      {
        dx: 31,
        dy: 108,
      },
      {
        dx: 50,
        dy: 108,
      },
      {
        dx: 68,
        dy: 108,
      },
      {
        dx: 68,
        dy: 124,
      },
    ],
  };
}

export function thermalRelay(x = 0, y = 0) {
  // Implementation of thermalRelay function
  return {
    x,
    y,
    width: 77,
    height: 112,
    type: "thermalRelay",
    name: "热继电器",
    images: [BASE_IMAGE_PATH + "thermal-relay.png"],
    nodes: [
      {
        dx: 10,
        dy: 6,
      },
      {
        dx: 32,
        dy: 6,
      },
      {
        dx: 53,
        dy: 6,
      },
      {
        dx: 10,
        dy: 71,
      },
      {
        dx: 29,
        dy: 71,
      },
      {
        dx: 48,
        dy: 71,
      },
      {
        dx: 67,
        dy: 71,
      },
      {
        dx: 17,
        dy: 95,
      },
      {
        dx: 39,
        dy: 95,
      },
      {
        dx: 61,
        dy: 95,
      },
    ],
  };
}

export function protector2(x = 0, y = 0) {
  // Implementation of protector2 function
  return {
    x,
    y,
    width: 74,
    height: 91,
    type: "protector2",
    name: "漏电保护器2p",
    images: [
      BASE_IMAGE_PATH + "Leakage-protector-2p.png",
      BASE_IMAGE_PATH + "Leakage-protector-2p-1.png",
    ],
    nodes: [
      {
        dx: 11,
        dy: 7,
      },
      {
        dx: 28,
        dy: 7,
      },
      {
        dx: 47,
        dy: 69,
      },
      {
        dx: 64,
        dy: 69,
      },
    ],
  };
}

export function ledTube(x = 0, y = 0) {
  // Implementation of ledTube function
  return {
    x,
    y,
    width: 181,
    height: 95,
    type: "ledTube",
    name: "led灯管",
    images: [
      BASE_IMAGE_PATH + "led-tube.png",
      BASE_IMAGE_PATH + "led-tube-1.png",
    ],
    nodes: [
      {
        dx: 6,
        dy: 47,
      },
      {
        dx: 175,
        dy: 47,
      },
    ],
  };
}

export function socket(x = 0, y = 0) {
  // Implementation of socket function
  return {
    x,
    y,
    width: 68,
    height: 108,
    type: "socket",
    name: "插座",
    images: [BASE_IMAGE_PATH + "socket.png"],
    nodes: [
      {
        dx: 8,
        dy: 6,
      },
      {
        dx: 34,
        dy: 6,
      },
      {
        dx: 59,
        dy: 6,
      },
    ],
  };
}

export function ammeter(x = 0, y = 0, opt = {}) {
  // Implementation of ammeter function
  var opt = opt || {},
    text = opt.text;
  return {
    x,
    y,
    width: 70,
    height: 70,
    type: "ammeter",
    name: "电流表",
    text: text,
    images: [
      BASE_IMAGE_PATH + "ammeter.png",
      BASE_IMAGE_PATH + "ammeter-1.png",
    ],
    nodes: [
      {
        dx: 61,
        dy: 9,
      },
      {
        dx: 61,
        dy: 61,
      },
    ],
  };
}

export function currentTransformer(x = 0, y = 0, opt = {}) {
  // Implementation of currentTransformer function
  var opt = opt || {},
    text = opt.text;
  return {
    x,
    y,
    width: 70,
    height: 86,
    type: "currentTransformer",
    name: "电流互感器",
    text: text,
    images: [BASE_IMAGE_PATH + "current-transformer.png"],
    nodes: [
      {
        dx: 9,
        dy: 16,
      },
      {
        dx: 61,
        dy: 16,
      },
      {
        dx: 9,
        dy: 77,
      },
      {
        dx: 61,
        dy: 77,
      },
    ],
  };
}

export function buzzer(x = 0, y = 0) {
  // Implementation of buzzer function
  return {
    x,
    y,
    width: 86,
    height: 36,
    type: "buzzer",
    name: "蜂鸣器",
    images: [
      BASE_IMAGE_PATH + "buzzer.png",
      BASE_IMAGE_PATH + "buzzer-1.png",
    ],
    nodes: [
      {
        dx: 6,
        dy: 30,
      },
      {
        dx: 80,
        dy: 30,
      },
    ],
  };
}

export function pilotLampBlue(x = 0, y = 0) {
  // Implementation of pilotLampBlue function
  return {
    x,
    y,
    width: 86,
    height: 36,
    type: "pilotLampBlue",
    name: "指示灯（蓝色）",
    images: [
      BASE_IMAGE_PATH + "lamp-blue.png",
      BASE_IMAGE_PATH + "lamp-blue-1.png",
    ],
    nodes: [
      {
        dx: 6,
        dy: 30,
      },
      {
        dx: 80,
        dy: 30,
      },
    ],
  };
}

export function pilotLampGreen(x = 0, y = 0) {
  // Implementation of pilotLampGreen function
  return {
    x,
    y,
    width: 86,
    height: 36,
    type: "pilotLampGreen",
    name: "指示灯（绿色）",
    images: [
      BASE_IMAGE_PATH + "lamp-green.png",
      BASE_IMAGE_PATH + "lamp-green-1.png",
    ],
    nodes: [
      {
        dx: 6,
        dy: 30,
      },
      {
        dx: 80,
        dy: 30,
      },
    ],
  };
}

export function pilotLampRed(x = 0, y = 0) {
  // Implementation of pilotLampRed function
  return {
    x,
    y,
    width: 86,
    height: 36,
    type: "pilotLampRed",
    name: "指示灯（红色）",
    images: [
      BASE_IMAGE_PATH + "lamp-red.png",
      BASE_IMAGE_PATH + "lamp-red-1.png",
    ],
    nodes: [
      {
        dx: 6,
        dy: 30,
      },
      {
        dx: 80,
        dy: 30,
      },
    ],
  };
}

export function pilotLampWhite(x = 0, y = 0) {
  // Implementation of pilotLampWhite function
  return {
    x,
    y,
    width: 86,
    height: 36,
    type: "pilotLampWhite",
    name: "指示灯（白色）",
    images: [
      BASE_IMAGE_PATH + "lamp-white.png",
      BASE_IMAGE_PATH + "lamp-white-1.png",
    ],
    nodes: [
      {
        dx: 6,
        dy: 30,
      },
      {
        dx: 80,
        dy: 30,
      },
    ],
  };
}

export function pilotLampYellow(x = 0, y = 0) {
  // Implementation of pilotLampYellow function
  return {
    x,
    y,
    width: 86,
    height: 36,
    type: "pilotLampYellow",
    name: "指示灯（黄色）",
    images: [
      BASE_IMAGE_PATH + "lamp-yellow.png",
      BASE_IMAGE_PATH + "lamp-yellow-1.png",
    ],
    nodes: [
      {
        dx: 6,
        dy: 30,
      },
      {
        dx: 80,
        dy: 30,
      },
    ],
  };
}

export function fuse1(x = 0, y = 0) {
  // Implementation of fuse1 function
  return {
    x,
    y,
    width: 22,  
    height: 99,
    type: "fuse1",
    name: "熔断器1p",
    images: [BASE_IMAGE_PATH + "fuse-1p.png"],
    nodes: [
      {
        dx: 11,
        dy: 11,
      },
      {
        dx: 11,
        dy: 90,
      },
    ],
  };
}

export function fuse2(x = 0, y = 0) {
  // Implementation of fuse2 function
  return {
    x,
    y,
    width: 44,
    height: 99,
    type: "fuse2",
    name: "熔断器2p",
    images: [BASE_IMAGE_PATH + "fuse-2p.png"],
    nodes: [
      {
        dx: 11,
        dy: 11,
      },
      {
        dx: 33,
        dy: 11,
      },
      {
        dx: 11,
        dy: 90,
      },
      {
        dx: 33,
        dy: 90,
      },
    ],
  };
}

export function selfLockButton(x = 0, y = 0) {
  // Implementation of selfLockButton function
  return compoundButtonFactory(x, y, {
    type: "selfLockButton",
    text: "自锁",
  });
}

export function selfLockButtonRed(x = 0, y = 0) {
  // Implementation of selfLockButtonRed function
  return compoundButtonFactory(x, y, {
    type: "selfLockButtonRed",
    color: "red",
    text: "自锁",
  });
}

export function stopButton(x = 0, y = 0) {
  // Implementation of stopButton function
  return {
    x,
    y,
    width: 81,
    height: 59,
    type: "stopButton",
    name: "急停按钮",
    images: [
      BASE_IMAGE_PATH + "stop-button.png",
      BASE_IMAGE_PATH + "stop-button-1.png",
    ],
    nodes: [
      {
        dx: 6,
        dy: 33,
      },
      {
        dx: 75,
        dy: 33,
      },
      {
        dx: 6,
        dy: 53,
      },
      {
        dx: 75,
        dy: 53,
      },
    ],
  };
}

export function terminalHorizontal(x = 0, y = 0) {
  // Implementation of terminalHorizontal function
  return {
    x,
    y,
    width: 143,
    height: 33,
    type: "terminalHorizontal",
    name: "端子排（横向）",
    images: [BASE_IMAGE_PATH + "terminal-horizontal.png"],
    nodes: [
      {
        dx: 8,
        dy: 8,
      },
      {
        dx: 26,
        dy: 8,
      },
      {
        dx: 44,
        dy: 8,
      },
      {
        dx: 63,
        dy: 8,
      },
      {
        dx: 81,
        dy: 8,
      },
      {
        dx: 99,
        dy: 8,
      },
      {
        dx: 8,
        dy: 25,
      },
      {
        dx: 26,
        dy: 25,
      },
      {
        dx: 44,
        dy: 25,
      },
      {
        dx: 63,
        dy: 25,
      },
      {
        dx: 81,
        dy: 25,
      },
      {
        dx: 99,
        dy: 25,
      },
    ],
  };
}

export function terminalVertical(x = 0, y = 0) {
  // Implementation of terminalVertical function
  return {
    x,
    y,
    width: 33,
    height: 143,
    type: "terminalVertical",
    name: "端子排（纵向）",
    images: [BASE_IMAGE_PATH + "terminal-vertical.png"],
    nodes: [
      {
        dx: 8,
        dy: 8,
      },
      {
        dx: 25,
        dy: 8,
      },
      {
        dx: 8,
        dy: 26,
      },
      {
        dx: 25,
        dy: 26,
      },
      {
        dx: 8,
        dy: 45,
      },
      {
        dx: 25,
        dy: 45,
      },
      {
        dx: 8,
        dy: 63,
      },
      {
        dx: 25,
        dy: 63,
      },
      {
        dx: 8,
        dy: 81,
      },
      {
        dx: 25,
        dy: 81,
      },
      {
        dx: 8,
        dy: 99,
      },
      {
        dx: 25,
        dy: 99,
      },
    ],
  };
}

// 统一收集所有工厂函数（可选）

export const circuitComponents = {
  ACContactor,ACContactor2,ACContactorClose,ACContactorClose2,
ACContactorOpen,ACContactorOpen2,ammeter,asw1,asw2,asw3,asyncMotor,bulb,button:compoundButtonFactory,buzzer,compoundButton,compoundButtonRed,currentTransformer,fuse1,fuse2,fuse3,ledTube,meter,motor,pilotLampBlue,pilotLampGreen,pilotLampRed,pilotLampWhite,pilotLampYellow,power1,power2,power3,power4,protector2,selfLockButton,selfLockButtonRed,socket,stopButton,sw1,sw2,sw3,sw4,sw5,sw6,terminalHorizontal,terminalVertical,thermalRelay
};

